
<!DOCTYPE html>

<html>
  
<!-- Mirrored from docs.sympy.org/latest/modules/diffgeom.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:24:20 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Differential Geometry &#8212; SymPy 1.9 documentation</title>
    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/default.css" />
    <link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="../_static/plot_directive.css" />
    <link rel="stylesheet" type="text/css" href="../../../live.sympy.org/static/live-core.css" />
    <link rel="stylesheet" type="text/css" href="../../../live.sympy.org/static/live-autocomplete.css" />
    <link rel="stylesheet" type="text/css" href="../../../live.sympy.org/static/live-sphinx.css" />
    
    <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
    <script src="../_static/jquery.js"></script>
    <script src="../_static/underscore.js"></script>
    <script src="../_static/doctools.js"></script>
    <script src="../../../live.sympy.org/static/utilities.js"></script>
    <script src="../../../live.sympy.org/static/external/classy.js"></script>
    <script src="../../../live.sympy.org/static/live-core.js"></script>
    <script src="../../../live.sympy.org/static/live-autocomplete.js"></script>
    <script src="../../../live.sympy.org/static/live-sphinx.js"></script>
    <script async="async" src="../../../cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest8331.js?config=TeX-AMS_HTML-full"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["\\(", "\\)"]], "displayMath": [["\\[", "\\]"]]}})</script>
    
    <link rel="shortcut icon" href="../_static/sympy-notailtext-favicon.ico"/>
    <link href="diffgeom.html" rel="canonical" />
    
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="Diophantine" href="solvers/diophantine.html" />
    <link rel="prev" title="Cryptography" href="crypto.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="solvers/diophantine.html" title="Diophantine"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="crypto.html" title="Cryptography"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">SymPy Modules Reference</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Differential Geometry</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="module-sympy.diffgeom">
<span id="differential-geometry"></span><h1>Differential Geometry<a class="headerlink" href="#module-sympy.diffgeom" title="Permalink to this headline">¶</a></h1>
<section id="introduction">
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
</section>
<section id="base-class-reference">
<h2>Base Class Reference<a class="headerlink" href="#base-class-reference" title="Permalink to this headline">¶</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="sympy.diffgeom.Manifold">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">Manifold</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dim</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L30-L88"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.Manifold" title="Permalink to this definition">¶</a></dt>
<dd><p>A mathematical manifold.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>name</strong> : str</p>
<blockquote>
<div><p>The name of the manifold.</p>
</div></blockquote>
<p><strong>dim</strong> : int</p>
<blockquote>
<div><p>The dimension of the manifold.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>A manifold is a topological space that locally resembles
Euclidean space near each point [1].
This class does not provide any means to study the topological
characteristics of the manifold that it represents, though.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">Manifold</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">m</span> <span class="o">=</span> <span class="n">Manifold</span><span class="p">(</span><span class="s1">&#39;M&#39;</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">m</span>
<span class="go">M</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">m</span><span class="o">.</span><span class="n">dim</span>
<span class="go">2</span>
</pre></div>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r151"><span class="brackets"><a class="fn-backref" href="#id1">R151</a></span></dt>
<dd><p><a class="reference external" href="https://en.wikipedia.org/wiki/Manifold">https://en.wikipedia.org/wiki/Manifold</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.diffgeom.Patch">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">Patch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">manifold</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L91-L159"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.Patch" title="Permalink to this definition">¶</a></dt>
<dd><p>A patch on a manifold.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>name</strong> : str</p>
<blockquote>
<div><p>The name of the patch.</p>
</div></blockquote>
<p><strong>manifold</strong> : Manifold</p>
<blockquote>
<div><p>The manifold on which the patch is defined.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>Coordinate patch, or patch in short, is a simply-connected open set around
a point in the manifold [1]. On a manifold one can have many patches that
do not always include the whole manifold. On these patches coordinate
charts can be defined that permit the parameterization of any point on the
patch in terms of a tuple of real numbers (the coordinates).</p>
<p>This class does not provide any means to study the topological
characteristics of the patch that it represents.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">Manifold</span><span class="p">,</span> <span class="n">Patch</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">m</span> <span class="o">=</span> <span class="n">Manifold</span><span class="p">(</span><span class="s1">&#39;M&#39;</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Patch</span><span class="p">(</span><span class="s1">&#39;P&#39;</span><span class="p">,</span> <span class="n">m</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span>
<span class="go">P</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">dim</span>
<span class="go">2</span>
</pre></div>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r152"><span class="brackets"><a class="fn-backref" href="#id2">R152</a></span></dt>
<dd><p>G. Sussman, J. Wisdom, W. Farr, Functional Differential Geometry
(2013)</p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">CoordSystem</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">patch</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">symbols</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">relations</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">{}</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L162-L713"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem" title="Permalink to this definition">¶</a></dt>
<dd><p>A coordinate system defined on the patch.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>name</strong> : str</p>
<blockquote>
<div><p>The name of the coordinate system.</p>
</div></blockquote>
<p><strong>patch</strong> : Patch</p>
<blockquote>
<div><p>The patch where the coordinate system is defined.</p>
</div></blockquote>
<p><strong>symbols</strong> : list of Symbols, optional</p>
<blockquote>
<div><p>Defines the names and assumptions of coordinate symbols.</p>
</div></blockquote>
<p><strong>relations</strong> : dict, optional</p>
<blockquote>
<div><p>Key is a tuple of two strings, who are the names of the systems where
the coordinates transform from and transform to.
Value is a tuple of the symbols before transformation and a tuple of
the expressions after transformation.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>Coordinate system is a system that uses one or more coordinates to uniquely
determine the position of the points or other geometric elements on a
manifold [1].</p>
<p>By passing <code class="docutils literal notranslate"><span class="pre">Symbols</span></code> to <em>symbols</em> parameter, user can define the name and
assumptions of coordinate symbols of the coordinate system. If not passed,
these symbols are generated automatically and are assumed to be real valued.</p>
<p>By passing <em>relations</em> parameter, user can define the tranform relations of
coordinate systems. Inverse transformation and indirect transformation can
be found automatically. If this parameter is not passed, coordinate
transformation cannot be done.</p>
<p class="rubric">Examples</p>
<p>We define two-dimensional Cartesian coordinate system and polar coordinate
system.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span><span class="p">,</span> <span class="n">pi</span><span class="p">,</span> <span class="n">sqrt</span><span class="p">,</span> <span class="n">atan2</span><span class="p">,</span> <span class="n">cos</span><span class="p">,</span> <span class="n">sin</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">Manifold</span><span class="p">,</span> <span class="n">Patch</span><span class="p">,</span> <span class="n">CoordSystem</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">m</span> <span class="o">=</span> <span class="n">Manifold</span><span class="p">(</span><span class="s1">&#39;M&#39;</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Patch</span><span class="p">(</span><span class="s1">&#39;P&#39;</span><span class="p">,</span> <span class="n">m</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;x y&#39;</span><span class="p">,</span> <span class="n">real</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span><span class="p">,</span> <span class="n">theta</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;r theta&#39;</span><span class="p">,</span> <span class="n">nonnegative</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">relation_dict</span> <span class="o">=</span> <span class="p">{</span>
<span class="gp">... </span><span class="p">(</span><span class="s1">&#39;Car2D&#39;</span><span class="p">,</span> <span class="s1">&#39;Pol&#39;</span><span class="p">):</span> <span class="p">[(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">),</span> <span class="p">(</span><span class="n">sqrt</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">y</span><span class="o">**</span><span class="mi">2</span><span class="p">),</span> <span class="n">atan2</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">))],</span>
<span class="gp">... </span><span class="p">(</span><span class="s1">&#39;Pol&#39;</span><span class="p">,</span> <span class="s1">&#39;Car2D&#39;</span><span class="p">):</span> <span class="p">[(</span><span class="n">r</span><span class="p">,</span> <span class="n">theta</span><span class="p">),</span> <span class="p">(</span><span class="n">r</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">theta</span><span class="p">),</span> <span class="n">r</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">theta</span><span class="p">))]</span>
<span class="gp">... </span><span class="p">}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Car2D</span> <span class="o">=</span> <span class="n">CoordSystem</span><span class="p">(</span><span class="s1">&#39;Car2D&#39;</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">),</span> <span class="n">relation_dict</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Pol</span> <span class="o">=</span> <span class="n">CoordSystem</span><span class="p">(</span><span class="s1">&#39;Pol&#39;</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="p">(</span><span class="n">r</span><span class="p">,</span> <span class="n">theta</span><span class="p">),</span> <span class="n">relation_dict</span><span class="p">)</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">symbols</span></code> property returns <code class="docutils literal notranslate"><span class="pre">CoordinateSymbol</span></code> instances. These symbols
are not same with the symbols used to construct the coordinate system.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Car2D</span>
<span class="go">Car2D</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Car2D</span><span class="o">.</span><span class="n">dim</span>
<span class="go">2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Car2D</span><span class="o">.</span><span class="n">symbols</span>
<span class="go">(x, y)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">_</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">func</span>
<span class="go">&lt;class &#39;sympy.diffgeom.diffgeom.CoordinateSymbol&#39;&gt;</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">transformation()</span></code> method returns the transformation function from
one coordinate system to another. <code class="docutils literal notranslate"><span class="pre">transform()</span></code> method returns the
transformed coordinates.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Car2D</span><span class="o">.</span><span class="n">transformation</span><span class="p">(</span><span class="n">Pol</span><span class="p">)</span>
<span class="go">Lambda((x, y), Matrix([</span>
<span class="go">[sqrt(x**2 + y**2)],</span>
<span class="go">[      atan2(y, x)]]))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Car2D</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">Pol</span><span class="p">)</span>
<span class="go">Matrix([</span>
<span class="go">[sqrt(x**2 + y**2)],</span>
<span class="go">[      atan2(y, x)]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Car2D</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">Pol</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="go">Matrix([</span>
<span class="go">[sqrt(5)],</span>
<span class="go">[atan(2)]])</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">jacobian()</span></code> method returns the Jacobian matrix of coordinate
transformation between two systems. <code class="docutils literal notranslate"><span class="pre">jacobian_determinant()</span></code> method
returns the Jacobian determinant of coordinate transformation between two
systems.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Pol</span><span class="o">.</span><span class="n">jacobian</span><span class="p">(</span><span class="n">Car2D</span><span class="p">)</span>
<span class="go">Matrix([</span>
<span class="go">[cos(theta), -r*sin(theta)],</span>
<span class="go">[sin(theta),  r*cos(theta)]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Pol</span><span class="o">.</span><span class="n">jacobian</span><span class="p">(</span><span class="n">Car2D</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="n">pi</span><span class="o">/</span><span class="mi">2</span><span class="p">])</span>
<span class="go">Matrix([</span>
<span class="go">[0, -1],</span>
<span class="go">[1,  0]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Car2D</span><span class="o">.</span><span class="n">jacobian_determinant</span><span class="p">(</span><span class="n">Pol</span><span class="p">)</span>
<span class="go">1/sqrt(x**2 + y**2)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Car2D</span><span class="o">.</span><span class="n">jacobian_determinant</span><span class="p">(</span><span class="n">Pol</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">])</span>
<span class="go">1</span>
</pre></div>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r153"><span class="brackets"><a class="fn-backref" href="#id3">R153</a></span></dt>
<dd><p><a class="reference external" href="https://en.wikipedia.org/wiki/Coordinate_system">https://en.wikipedia.org/wiki/Coordinate_system</a></p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.base_oneform">
<span class="sig-name descname"><span class="pre">base_oneform</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coord_index</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L704-L708"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.base_oneform" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a basis 1-form field.
The basis one-form field for this coordinate system. It is also an
operator on vector fields.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.base_oneforms">
<span class="sig-name descname"><span class="pre">base_oneforms</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L710-L713"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.base_oneforms" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a list of all base oneforms.
For more details see the <code class="docutils literal notranslate"><span class="pre">base_oneform</span></code> method of this class.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.base_scalar">
<span class="sig-name descname"><span class="pre">base_scalar</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coord_index</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L682-L684"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.base_scalar" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">BaseScalarField</span></code> that takes a point and returns one of the coordinates.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.base_scalars">
<span class="sig-name descname"><span class="pre">base_scalars</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L687-L690"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.base_scalars" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a list of all coordinate functions.
For more details see the <code class="docutils literal notranslate"><span class="pre">base_scalar</span></code> method of this class.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.base_vector">
<span class="sig-name descname"><span class="pre">base_vector</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coord_index</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L693-L697"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.base_vector" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a basis vector field.
The basis vector field for this coordinate system. It is also an
operator on scalar fields.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.base_vectors">
<span class="sig-name descname"><span class="pre">base_vectors</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L699-L702"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.base_vectors" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a list of all base vectors.
For more details see the <code class="docutils literal notranslate"><span class="pre">base_vector</span></code> method of this class.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.coord_function">
<span class="sig-name descname"><span class="pre">coord_function</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coord_index</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L682-L684"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.coord_function" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">BaseScalarField</span></code> that takes a point and returns one of the coordinates.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.coord_functions">
<span class="sig-name descname"><span class="pre">coord_functions</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L687-L690"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.coord_functions" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a list of all coordinate functions.
For more details see the <code class="docutils literal notranslate"><span class="pre">base_scalar</span></code> method of this class.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.coord_tuple_transform_to">
<span class="sig-name descname"><span class="pre">coord_tuple_transform_to</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">to_sys</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coords</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L583-L596"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.coord_tuple_transform_to" title="Permalink to this definition">¶</a></dt>
<dd><p>Transform <code class="docutils literal notranslate"><span class="pre">coords</span></code> to coord system <code class="docutils literal notranslate"><span class="pre">to_sys</span></code>.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.jacobian">
<span class="sig-name descname"><span class="pre">jacobian</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sys</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coordinates</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L598-L632"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.jacobian" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the jacobian matrix of a transformation on given coordinates.
If coordinates are not given, coordinate symbols of <em>self</em> are used.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>sys</strong> : CoordSystem</p>
<p><strong>coordinates</strong> : Any iterable, optional.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>sympy.ImmutableDenseMatrix</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_r</span><span class="p">,</span> <span class="n">R2_p</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R2_p</span><span class="o">.</span><span class="n">jacobian</span><span class="p">(</span><span class="n">R2_r</span><span class="p">)</span>
<span class="go">Matrix([</span>
<span class="go">[cos(theta), -rho*sin(theta)],</span>
<span class="go">[sin(theta),  rho*cos(theta)]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R2_p</span><span class="o">.</span><span class="n">jacobian</span><span class="p">(</span><span class="n">R2_r</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span>
<span class="go">Matrix([</span>
<span class="go">[1, 0],</span>
<span class="go">[0, 1]])</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.jacobian_determinant">
<span class="sig-name descname"><span class="pre">jacobian_determinant</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sys</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coordinates</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L635-L663"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.jacobian_determinant" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the jacobian determinant of a transformation on given
coordinates. If coordinates are not given, coordinate symbols of <em>self</em>
are used.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>sys</strong> : CoordSystem</p>
<p><strong>coordinates</strong> : Any iterable, optional.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>sympy.Expr</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_r</span><span class="p">,</span> <span class="n">R2_p</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R2_r</span><span class="o">.</span><span class="n">jacobian_determinant</span><span class="p">(</span><span class="n">R2_p</span><span class="p">)</span>
<span class="go">1/sqrt(x**2 + y**2)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R2_r</span><span class="o">.</span><span class="n">jacobian_determinant</span><span class="p">(</span><span class="n">R2_p</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span>
<span class="go">1</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.jacobian_matrix">
<span class="sig-name descname"><span class="pre">jacobian_matrix</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sys</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coordinates</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L598-L632"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.jacobian_matrix" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the jacobian matrix of a transformation on given coordinates.
If coordinates are not given, coordinate symbols of <em>self</em> are used.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>sys</strong> : CoordSystem</p>
<p><strong>coordinates</strong> : Any iterable, optional.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>sympy.ImmutableDenseMatrix</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_r</span><span class="p">,</span> <span class="n">R2_p</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R2_p</span><span class="o">.</span><span class="n">jacobian</span><span class="p">(</span><span class="n">R2_r</span><span class="p">)</span>
<span class="go">Matrix([</span>
<span class="go">[cos(theta), -rho*sin(theta)],</span>
<span class="go">[sin(theta),  rho*cos(theta)]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R2_p</span><span class="o">.</span><span class="n">jacobian</span><span class="p">(</span><span class="n">R2_r</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span>
<span class="go">Matrix([</span>
<span class="go">[1, 0],</span>
<span class="go">[0, 1]])</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.point">
<span class="sig-name descname"><span class="pre">point</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coords</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L670-L672"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.point" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a <code class="docutils literal notranslate"><span class="pre">Point</span></code> with coordinates given in this coord system.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.point_to_coords">
<span class="sig-name descname"><span class="pre">point_to_coords</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">point</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L674-L676"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.point_to_coords" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculate the coordinates of a point in this coord system.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.transform">
<span class="sig-name descname"><span class="pre">transform</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sys</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coordinates</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L543-L581"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.transform" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the result of coordinate transformation from <em>self</em> to <em>sys</em>.
If coordinates are not given, coordinate symbols of <em>self</em> are used.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>sys</strong> : CoordSystem</p>
<p><strong>coordinates</strong> : Any iterable, optional.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>sympy.ImmutableDenseMatrix containing CoordinateSymbol</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_r</span><span class="p">,</span> <span class="n">R2_p</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R2_r</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">R2_p</span><span class="p">)</span>
<span class="go">Matrix([</span>
<span class="go">[sqrt(x**2 + y**2)],</span>
<span class="go">[      atan2(y, x)]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R2_r</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">R2_p</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="go">Matrix([</span>
<span class="go">[   1],</span>
<span class="go">[pi/2]])</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordSystem.transformation">
<span class="sig-name descname"><span class="pre">transformation</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sys</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L374-L409"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordSystem.transformation" title="Permalink to this definition">¶</a></dt>
<dd><p>Return coordinate transformation function from <em>self</em> to <em>sys</em>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>sys</strong> : CoordSystem</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>sympy.Lambda</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_r</span><span class="p">,</span> <span class="n">R2_p</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R2_r</span><span class="o">.</span><span class="n">transformation</span><span class="p">(</span><span class="n">R2_p</span><span class="p">)</span>
<span class="go">Lambda((x, y), Matrix([</span>
<span class="go">[sqrt(x**2 + y**2)],</span>
<span class="go">[      atan2(y, x)]]))</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.diffgeom.CoordinateSymbol">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">CoordinateSymbol</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coord_sys</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">index</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">assumptions</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L716-L791"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CoordinateSymbol" title="Permalink to this definition">¶</a></dt>
<dd><p>A symbol which denotes an abstract value of i-th coordinate of
the coordinate system with given context.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>coord_sys</strong> : CoordSystem</p>
<p><strong>index</strong> : integer</p>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>Each coordinates in coordinate system are represented by unique symbol,
such as x, y, z in Cartesian coordinate system.</p>
<p>You may not construct this class directly. Instead, use <span class="math notranslate nohighlight">\(symbols\)</span> method
of CoordSystem.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span><span class="p">,</span> <span class="n">Lambda</span><span class="p">,</span> <span class="n">Matrix</span><span class="p">,</span> <span class="n">sqrt</span><span class="p">,</span> <span class="n">atan2</span><span class="p">,</span> <span class="n">cos</span><span class="p">,</span> <span class="n">sin</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">Manifold</span><span class="p">,</span> <span class="n">Patch</span><span class="p">,</span> <span class="n">CoordSystem</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">m</span> <span class="o">=</span> <span class="n">Manifold</span><span class="p">(</span><span class="s1">&#39;M&#39;</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Patch</span><span class="p">(</span><span class="s1">&#39;P&#39;</span><span class="p">,</span> <span class="n">m</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;x y&#39;</span><span class="p">,</span> <span class="n">real</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span><span class="p">,</span> <span class="n">theta</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;r theta&#39;</span><span class="p">,</span> <span class="n">nonnegative</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">relation_dict</span> <span class="o">=</span> <span class="p">{</span>
<span class="gp">... </span><span class="p">(</span><span class="s1">&#39;Car2D&#39;</span><span class="p">,</span> <span class="s1">&#39;Pol&#39;</span><span class="p">):</span> <span class="n">Lambda</span><span class="p">((</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">),</span> <span class="n">Matrix</span><span class="p">([</span><span class="n">sqrt</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">y</span><span class="o">**</span><span class="mi">2</span><span class="p">),</span> <span class="n">atan2</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">)])),</span>
<span class="gp">... </span><span class="p">(</span><span class="s1">&#39;Pol&#39;</span><span class="p">,</span> <span class="s1">&#39;Car2D&#39;</span><span class="p">):</span> <span class="n">Lambda</span><span class="p">((</span><span class="n">r</span><span class="p">,</span> <span class="n">theta</span><span class="p">),</span> <span class="n">Matrix</span><span class="p">([</span><span class="n">r</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">theta</span><span class="p">),</span> <span class="n">r</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">theta</span><span class="p">)]))</span>
<span class="gp">... </span><span class="p">}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Car2D</span> <span class="o">=</span> <span class="n">CoordSystem</span><span class="p">(</span><span class="s1">&#39;Car2D&#39;</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="p">[</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">],</span> <span class="n">relation_dict</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Pol</span> <span class="o">=</span> <span class="n">CoordSystem</span><span class="p">(</span><span class="s1">&#39;Pol&#39;</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="p">[</span><span class="n">r</span><span class="p">,</span> <span class="n">theta</span><span class="p">],</span> <span class="n">relation_dict</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">Car2D</span><span class="o">.</span><span class="n">symbols</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">CoordinateSymbol</span></code> contains its coordinate symbol and index.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="o">.</span><span class="n">name</span>
<span class="go">&#39;x&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="o">.</span><span class="n">coord_sys</span> <span class="o">==</span> <span class="n">Car2D</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="o">.</span><span class="n">index</span>
<span class="go">0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="o">.</span><span class="n">is_real</span>
<span class="go">True</span>
</pre></div>
</div>
<p>You can transform <code class="docutils literal notranslate"><span class="pre">CoordinateSymbol</span></code> into other coordinate system using
<code class="docutils literal notranslate"><span class="pre">rewrite()</span></code> method.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="o">.</span><span class="n">rewrite</span><span class="p">(</span><span class="n">Pol</span><span class="p">)</span>
<span class="go">r*cos(theta)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">sqrt</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">y</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">rewrite</span><span class="p">(</span><span class="n">Pol</span><span class="p">)</span><span class="o">.</span><span class="n">simplify</span><span class="p">()</span>
<span class="go">r</span>
</pre></div>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.diffgeom.Point">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">Point</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coord_sys</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coords</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L794-L874"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.Point" title="Permalink to this definition">¶</a></dt>
<dd><p>Point defined in a coordinate system.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>coord_sys</strong> : CoordSystem</p>
<p><strong>coords</strong> : list</p>
<blockquote>
<div><p>The coordinates of the point.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>Mathematically, point is defined in the manifold and does not have any coordinates
by itself. Coordinate system is what imbues the coordinates to the point by coordinate
chart. However, due to the difficulty of realizing such logic, you must supply
a coordinate system and coordinates to define a Point here.</p>
<p>The usage of this object after its definition is independent of the
coordinate system that was used in order to define it, however due to
limitations in the simplification routines you can arrive at complicated
expressions if you use inappropriate coordinate systems.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">pi</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2</span><span class="p">,</span> <span class="n">R2_r</span><span class="p">,</span> <span class="n">R2_p</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rho</span><span class="p">,</span> <span class="n">theta</span> <span class="o">=</span> <span class="n">R2_p</span><span class="o">.</span><span class="n">symbols</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="n">R2_p</span><span class="p">,</span> <span class="p">[</span><span class="n">rho</span><span class="p">,</span> <span class="mi">3</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">4</span><span class="p">])</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">manifold</span> <span class="o">==</span> <span class="n">R2</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">coords</span><span class="p">()</span>
<span class="go">Matrix([</span>
<span class="go">[   rho],</span>
<span class="go">[3*pi/4]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">coords</span><span class="p">(</span><span class="n">R2_r</span><span class="p">)</span>
<span class="go">Matrix([</span>
<span class="go">[-sqrt(2)*rho/2],</span>
<span class="go">[ sqrt(2)*rho/2]])</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.diffgeom.Point.coords">
<span class="sig-name descname"><span class="pre">coords</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sys</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L861-L870"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.Point.coords" title="Permalink to this definition">¶</a></dt>
<dd><p>Coordinates of the point in given coordinate system. If coordinate system
is not passed, it returns the coordinates in the coordinate system in which
the poin was defined.</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.diffgeom.BaseScalarField">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">BaseScalarField</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coord_sys</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">index</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L877-L978"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.BaseScalarField" title="Permalink to this definition">¶</a></dt>
<dd><p>Base scalar field over a manifold for a given coordinate system.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>coord_sys</strong> : CoordSystem</p>
<p><strong>index</strong> : integer</p>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>A scalar field takes a point as an argument and returns a scalar.
A base scalar field of a coordinate system takes a point and returns one of
the coordinates of that point in the coordinate system in question.</p>
<p>To define a scalar field you need to choose the coordinate system and the
index of the coordinate.</p>
<p>The use of the scalar field after its definition is independent of the
coordinate system in which it was defined, however due to limitations in
the simplification routines you may arrive at more complicated
expression if you use unappropriate coordinate systems.
You can build complicated scalar fields by just building up SymPy
expressions containing <code class="docutils literal notranslate"><span class="pre">BaseScalarField</span></code> instances.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Function</span><span class="p">,</span> <span class="n">pi</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">BaseScalarField</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_r</span><span class="p">,</span> <span class="n">R2_p</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rho</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">R2_p</span><span class="o">.</span><span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">point</span> <span class="o">=</span> <span class="n">R2_p</span><span class="o">.</span><span class="n">point</span><span class="p">([</span><span class="n">rho</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">fx</span><span class="p">,</span> <span class="n">fy</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_scalars</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ftheta</span> <span class="o">=</span> <span class="n">BaseScalarField</span><span class="p">(</span><span class="n">R2_r</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fx</span><span class="p">(</span><span class="n">point</span><span class="p">)</span>
<span class="go">rho</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">fy</span><span class="p">(</span><span class="n">point</span><span class="p">)</span>
<span class="go">0</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="p">(</span><span class="n">fx</span><span class="o">**</span><span class="mi">2</span><span class="o">+</span><span class="n">fy</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">rcall</span><span class="p">(</span><span class="n">point</span><span class="p">)</span>
<span class="go">rho**2</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">g</span> <span class="o">=</span> <span class="n">Function</span><span class="p">(</span><span class="s1">&#39;g&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">fg</span> <span class="o">=</span> <span class="n">g</span><span class="p">(</span><span class="n">ftheta</span><span class="o">-</span><span class="n">pi</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">fg</span><span class="o">.</span><span class="n">rcall</span><span class="p">(</span><span class="n">point</span><span class="p">)</span>
<span class="go">g(-pi)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.diffgeom.BaseVectorField">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">BaseVectorField</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coord_sys</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">index</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L981-L1102"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.BaseVectorField" title="Permalink to this definition">¶</a></dt>
<dd><p>Base vector field over a manifold for a given coordinate system.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>coord_sys</strong> : CoordSystem</p>
<p><strong>index</strong> : integer</p>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>A vector field is an operator taking a scalar field and returning a
directional derivative (which is also a scalar field).
A base vector field is the same type of operator, however the derivation is
specifically done with respect to a chosen coordinate.</p>
<p>To define a base vector field you need to choose the coordinate system and
the index of the coordinate.</p>
<p>The use of the vector field after its definition is independent of the
coordinate system in which it was defined, however due to limitations in the
simplification routines you may arrive at more complicated expression if you
use unappropriate coordinate systems.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Function</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_p</span><span class="p">,</span> <span class="n">R2_r</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">BaseVectorField</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">pprint</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rho</span><span class="p">,</span> <span class="n">theta</span> <span class="o">=</span> <span class="n">R2_p</span><span class="o">.</span><span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">fx</span><span class="p">,</span> <span class="n">fy</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_scalars</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">point_p</span> <span class="o">=</span> <span class="n">R2_p</span><span class="o">.</span><span class="n">point</span><span class="p">([</span><span class="n">rho</span><span class="p">,</span> <span class="n">theta</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">point_r</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">point</span><span class="p">([</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">])</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">g</span> <span class="o">=</span> <span class="n">Function</span><span class="p">(</span><span class="s1">&#39;g&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s_field</span> <span class="o">=</span> <span class="n">g</span><span class="p">(</span><span class="n">fx</span><span class="p">,</span> <span class="n">fy</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">v</span> <span class="o">=</span> <span class="n">BaseVectorField</span><span class="p">(</span><span class="n">R2_r</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pprint</span><span class="p">(</span><span class="n">v</span><span class="p">(</span><span class="n">s_field</span><span class="p">))</span>
<span class="go">/ d           \|</span>
<span class="go">|---(g(x, xi))||</span>
<span class="go">\dxi          /|xi=y</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pprint</span><span class="p">(</span><span class="n">v</span><span class="p">(</span><span class="n">s_field</span><span class="p">)</span><span class="o">.</span><span class="n">rcall</span><span class="p">(</span><span class="n">point_r</span><span class="p">)</span><span class="o">.</span><span class="n">doit</span><span class="p">())</span>
<span class="go">d</span>
<span class="go">--(g(x, y))</span>
<span class="go">dy</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pprint</span><span class="p">(</span><span class="n">v</span><span class="p">(</span><span class="n">s_field</span><span class="p">)</span><span class="o">.</span><span class="n">rcall</span><span class="p">(</span><span class="n">point_p</span><span class="p">))</span>
<span class="go">/ d                        \|</span>
<span class="go">|---(g(rho*cos(theta), xi))||</span>
<span class="go">\dxi                       /|xi=rho*sin(theta)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.diffgeom.Commutator">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">Commutator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">v1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">v2</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L1114-L1189"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.Commutator" title="Permalink to this definition">¶</a></dt>
<dd><p>Commutator of two vector fields.</p>
<p class="rubric">Explanation</p>
<p>The commutator of two vector fields <span class="math notranslate nohighlight">\(v_1\)</span> and <span class="math notranslate nohighlight">\(v_2\)</span> is defined as the
vector field <span class="math notranslate nohighlight">\([v_1, v_2]\)</span> that evaluated on each scalar field <span class="math notranslate nohighlight">\(f\)</span> is equal
to <span class="math notranslate nohighlight">\(v_1(v_2(f)) - v_2(v_1(f))\)</span>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_p</span><span class="p">,</span> <span class="n">R2_r</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">Commutator</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify</span> <span class="kn">import</span> <span class="n">simplify</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fx</span><span class="p">,</span> <span class="n">fy</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_scalars</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_vectors</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">e_r</span> <span class="o">=</span> <span class="n">R2_p</span><span class="o">.</span><span class="n">base_vector</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">c_xy</span> <span class="o">=</span> <span class="n">Commutator</span><span class="p">(</span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">c_xr</span> <span class="o">=</span> <span class="n">Commutator</span><span class="p">(</span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_r</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">c_xy</span>
<span class="go">0</span>
</pre></div>
</div>
<p>Unfortunately, the current code is not able to compute everything:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">c_xr</span>
<span class="go">Commutator(e_x, e_rho)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">simplify</span><span class="p">(</span><span class="n">c_xr</span><span class="p">(</span><span class="n">fy</span><span class="o">**</span><span class="mi">2</span><span class="p">))</span>
<span class="go">-2*cos(theta)*y**2/(x**2 + y**2)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.diffgeom.Differential">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">Differential</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">form_field</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L1192-L1299"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.Differential" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the differential (exterior derivative) of a form field.</p>
<p class="rubric">Explanation</p>
<p>The differential of a form (i.e. the exterior derivative) has a complicated
definition in the general case.
The differential <span class="math notranslate nohighlight">\(df\)</span> of the 0-form <span class="math notranslate nohighlight">\(f\)</span> is defined for any vector field <span class="math notranslate nohighlight">\(v\)</span>
as <span class="math notranslate nohighlight">\(df(v) = v(f)\)</span>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Function</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_r</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">Differential</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">pprint</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fx</span><span class="p">,</span> <span class="n">fy</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_scalars</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_vectors</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span> <span class="o">=</span> <span class="n">Function</span><span class="p">(</span><span class="s1">&#39;g&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s_field</span> <span class="o">=</span> <span class="n">g</span><span class="p">(</span><span class="n">fx</span><span class="p">,</span> <span class="n">fy</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">dg</span> <span class="o">=</span> <span class="n">Differential</span><span class="p">(</span><span class="n">s_field</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">dg</span>
<span class="go">d(g(x, y))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pprint</span><span class="p">(</span><span class="n">dg</span><span class="p">(</span><span class="n">e_x</span><span class="p">))</span>
<span class="go">/ d           \|</span>
<span class="go">|---(g(xi, y))||</span>
<span class="go">\dxi          /|xi=x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pprint</span><span class="p">(</span><span class="n">dg</span><span class="p">(</span><span class="n">e_y</span><span class="p">))</span>
<span class="go">/ d           \|</span>
<span class="go">|---(g(x, xi))||</span>
<span class="go">\dxi          /|xi=y</span>
</pre></div>
</div>
<p>Applying the exterior derivative operator twice always results in:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Differential</span><span class="p">(</span><span class="n">dg</span><span class="p">)</span>
<span class="go">0</span>
</pre></div>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.diffgeom.TensorProduct">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">TensorProduct</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L1302-L1386"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.TensorProduct" title="Permalink to this definition">¶</a></dt>
<dd><p>Tensor product of forms.</p>
<p class="rubric">Explanation</p>
<p>The tensor product permits the creation of multilinear functionals (i.e.
higher order tensors) out of lower order fields (e.g. 1-forms and vector
fields). However, the higher tensors thus created lack the interesting
features provided by the other type of product, the wedge product, namely
they are not antisymmetric and hence are not form fields.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_r</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">TensorProduct</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fx</span><span class="p">,</span> <span class="n">fy</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_scalars</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_vectors</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">dx</span><span class="p">,</span> <span class="n">dy</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_oneforms</span><span class="p">()</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TensorProduct</span><span class="p">(</span><span class="n">dx</span><span class="p">,</span> <span class="n">dy</span><span class="p">)(</span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span><span class="p">)</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TensorProduct</span><span class="p">(</span><span class="n">dx</span><span class="p">,</span> <span class="n">dy</span><span class="p">)(</span><span class="n">e_y</span><span class="p">,</span> <span class="n">e_x</span><span class="p">)</span>
<span class="go">0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TensorProduct</span><span class="p">(</span><span class="n">dx</span><span class="p">,</span> <span class="n">fx</span><span class="o">*</span><span class="n">dy</span><span class="p">)(</span><span class="n">fx</span><span class="o">*</span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span><span class="p">)</span>
<span class="go">x**2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TensorProduct</span><span class="p">(</span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span><span class="p">)(</span><span class="n">fx</span><span class="o">**</span><span class="mi">2</span><span class="p">,</span> <span class="n">fy</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span>
<span class="go">4*x*y</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TensorProduct</span><span class="p">(</span><span class="n">e_y</span><span class="p">,</span> <span class="n">dx</span><span class="p">)(</span><span class="n">fy</span><span class="p">)</span>
<span class="go">dx</span>
</pre></div>
</div>
<p>You can nest tensor products.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">tp1</span> <span class="o">=</span> <span class="n">TensorProduct</span><span class="p">(</span><span class="n">dx</span><span class="p">,</span> <span class="n">dy</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TensorProduct</span><span class="p">(</span><span class="n">tp1</span><span class="p">,</span> <span class="n">dx</span><span class="p">)(</span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span><span class="p">,</span> <span class="n">e_x</span><span class="p">)</span>
<span class="go">1</span>
</pre></div>
</div>
<p>You can make partial contraction for instance when ‘raising an index’.
Putting <code class="docutils literal notranslate"><span class="pre">None</span></code> in the second argument of <code class="docutils literal notranslate"><span class="pre">rcall</span></code> means that the
respective position in the tensor product is left as it is.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TP</span> <span class="o">=</span> <span class="n">TensorProduct</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">metric</span> <span class="o">=</span> <span class="n">TP</span><span class="p">(</span><span class="n">dx</span><span class="p">,</span> <span class="n">dx</span><span class="p">)</span> <span class="o">+</span> <span class="mi">3</span><span class="o">*</span><span class="n">TP</span><span class="p">(</span><span class="n">dy</span><span class="p">,</span> <span class="n">dy</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">metric</span><span class="o">.</span><span class="n">rcall</span><span class="p">(</span><span class="n">e_y</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="go">3*dy</span>
</pre></div>
</div>
<p>Or automatically pad the args with <code class="docutils literal notranslate"><span class="pre">None</span></code> without specifying them.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">metric</span><span class="o">.</span><span class="n">rcall</span><span class="p">(</span><span class="n">e_y</span><span class="p">)</span>
<span class="go">3*dy</span>
</pre></div>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.diffgeom.WedgeProduct">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">WedgeProduct</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L1389-L1435"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.WedgeProduct" title="Permalink to this definition">¶</a></dt>
<dd><p>Wedge product of forms.</p>
<p class="rubric">Explanation</p>
<p>In the context of integration only completely antisymmetric forms make
sense. The wedge product permits the creation of such forms.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_r</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">WedgeProduct</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fx</span><span class="p">,</span> <span class="n">fy</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_scalars</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_vectors</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">dx</span><span class="p">,</span> <span class="n">dy</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_oneforms</span><span class="p">()</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">WedgeProduct</span><span class="p">(</span><span class="n">dx</span><span class="p">,</span> <span class="n">dy</span><span class="p">)(</span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span><span class="p">)</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">WedgeProduct</span><span class="p">(</span><span class="n">dx</span><span class="p">,</span> <span class="n">dy</span><span class="p">)(</span><span class="n">e_y</span><span class="p">,</span> <span class="n">e_x</span><span class="p">)</span>
<span class="go">-1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">WedgeProduct</span><span class="p">(</span><span class="n">dx</span><span class="p">,</span> <span class="n">fx</span><span class="o">*</span><span class="n">dy</span><span class="p">)(</span><span class="n">fx</span><span class="o">*</span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span><span class="p">)</span>
<span class="go">x**2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">WedgeProduct</span><span class="p">(</span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span><span class="p">)(</span><span class="n">fy</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="go">-e_x</span>
</pre></div>
</div>
<p>You can nest wedge products.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">wp1</span> <span class="o">=</span> <span class="n">WedgeProduct</span><span class="p">(</span><span class="n">dx</span><span class="p">,</span> <span class="n">dy</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">WedgeProduct</span><span class="p">(</span><span class="n">wp1</span><span class="p">,</span> <span class="n">dx</span><span class="p">)(</span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span><span class="p">,</span> <span class="n">e_x</span><span class="p">)</span>
<span class="go">0</span>
</pre></div>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.diffgeom.LieDerivative">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">LieDerivative</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">v_field</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">expr</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L1438-L1512"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.LieDerivative" title="Permalink to this definition">¶</a></dt>
<dd><p>Lie derivative with respect to a vector field.</p>
<p class="rubric">Explanation</p>
<p>The transport operator that defines the Lie derivative is the pushforward of
the field to be derived along the integral curve of the field with respect
to which one derives.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_r</span><span class="p">,</span> <span class="n">R2_p</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="p">(</span><span class="n">LieDerivative</span><span class="p">,</span> <span class="n">TensorProduct</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fx</span><span class="p">,</span> <span class="n">fy</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_scalars</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_vectors</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">e_rho</span><span class="p">,</span> <span class="n">e_theta</span> <span class="o">=</span> <span class="n">R2_p</span><span class="o">.</span><span class="n">base_vectors</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">dx</span><span class="p">,</span> <span class="n">dy</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_oneforms</span><span class="p">()</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">LieDerivative</span><span class="p">(</span><span class="n">e_x</span><span class="p">,</span> <span class="n">fy</span><span class="p">)</span>
<span class="go">0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">LieDerivative</span><span class="p">(</span><span class="n">e_x</span><span class="p">,</span> <span class="n">fx</span><span class="p">)</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">LieDerivative</span><span class="p">(</span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_x</span><span class="p">)</span>
<span class="go">0</span>
</pre></div>
</div>
<p>The Lie derivative of a tensor field by another tensor field is equal to
their commutator:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">LieDerivative</span><span class="p">(</span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_rho</span><span class="p">)</span>
<span class="go">Commutator(e_x, e_rho)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">LieDerivative</span><span class="p">(</span><span class="n">e_x</span> <span class="o">+</span> <span class="n">e_y</span><span class="p">,</span> <span class="n">fx</span><span class="p">)</span>
<span class="go">1</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">tp</span> <span class="o">=</span> <span class="n">TensorProduct</span><span class="p">(</span><span class="n">dx</span><span class="p">,</span> <span class="n">dy</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">LieDerivative</span><span class="p">(</span><span class="n">e_x</span><span class="p">,</span> <span class="n">tp</span><span class="p">)</span>
<span class="go">LieDerivative(e_x, TensorProduct(dx, dy))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">LieDerivative</span><span class="p">(</span><span class="n">e_x</span><span class="p">,</span> <span class="n">tp</span><span class="p">)</span>
<span class="go">LieDerivative(e_x, TensorProduct(dx, dy))</span>
</pre></div>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.diffgeom.BaseCovarDerivativeOp">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">BaseCovarDerivativeOp</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coord_sys</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">index</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">christoffel</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L1515-L1603"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.BaseCovarDerivativeOp" title="Permalink to this definition">¶</a></dt>
<dd><p>Covariant derivative operator with respect to a base vector.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_r</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">BaseCovarDerivativeOp</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">metric_to_Christoffel_2nd</span><span class="p">,</span> <span class="n">TensorProduct</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TP</span> <span class="o">=</span> <span class="n">TensorProduct</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">fx</span><span class="p">,</span> <span class="n">fy</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_scalars</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_vectors</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">dx</span><span class="p">,</span> <span class="n">dy</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_oneforms</span><span class="p">()</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">ch</span> <span class="o">=</span> <span class="n">metric_to_Christoffel_2nd</span><span class="p">(</span><span class="n">TP</span><span class="p">(</span><span class="n">dx</span><span class="p">,</span> <span class="n">dx</span><span class="p">)</span> <span class="o">+</span> <span class="n">TP</span><span class="p">(</span><span class="n">dy</span><span class="p">,</span> <span class="n">dy</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ch</span>
<span class="go">[[[0, 0], [0, 0]], [[0, 0], [0, 0]]]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cvd</span> <span class="o">=</span> <span class="n">BaseCovarDerivativeOp</span><span class="p">(</span><span class="n">R2_r</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ch</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cvd</span><span class="p">(</span><span class="n">fx</span><span class="p">)</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cvd</span><span class="p">(</span><span class="n">fx</span><span class="o">*</span><span class="n">e_x</span><span class="p">)</span>
<span class="go">e_x</span>
</pre></div>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.diffgeom.CovarDerivativeOp">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">CovarDerivativeOp</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">wrt</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">christoffel</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L1606-L1656"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.CovarDerivativeOp" title="Permalink to this definition">¶</a></dt>
<dd><p>Covariant derivative operator.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_r</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">CovarDerivativeOp</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">metric_to_Christoffel_2nd</span><span class="p">,</span> <span class="n">TensorProduct</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TP</span> <span class="o">=</span> <span class="n">TensorProduct</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">fx</span><span class="p">,</span> <span class="n">fy</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_scalars</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">e_x</span><span class="p">,</span> <span class="n">e_y</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_vectors</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">dx</span><span class="p">,</span> <span class="n">dy</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">base_oneforms</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ch</span> <span class="o">=</span> <span class="n">metric_to_Christoffel_2nd</span><span class="p">(</span><span class="n">TP</span><span class="p">(</span><span class="n">dx</span><span class="p">,</span> <span class="n">dx</span><span class="p">)</span> <span class="o">+</span> <span class="n">TP</span><span class="p">(</span><span class="n">dy</span><span class="p">,</span> <span class="n">dy</span><span class="p">))</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">ch</span>
<span class="go">[[[0, 0], [0, 0]], [[0, 0], [0, 0]]]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cvd</span> <span class="o">=</span> <span class="n">CovarDerivativeOp</span><span class="p">(</span><span class="n">fx</span><span class="o">*</span><span class="n">e_x</span><span class="p">,</span> <span class="n">ch</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cvd</span><span class="p">(</span><span class="n">fx</span><span class="p">)</span>
<span class="go">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cvd</span><span class="p">(</span><span class="n">fx</span><span class="o">*</span><span class="n">e_x</span><span class="p">)</span>
<span class="go">x*e_x</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.diffgeom.intcurve_series">
<span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">intcurve_series</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">vector_field</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">param</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">start_point</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">6</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coord_sys</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coeffs</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L1662-L1780"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.intcurve_series" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the series expansion for an integral curve of the field.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>vector_field</strong></p>
<blockquote>
<div><p>the vector field for which an integral curve will be given</p>
</div></blockquote>
<p><strong>param</strong></p>
<blockquote>
<div><p>the argument of the function <span class="math notranslate nohighlight">\(\gamma\)</span> from R to the curve</p>
</div></blockquote>
<p><strong>start_point</strong></p>
<blockquote>
<div><p>the point which corresponds to <span class="math notranslate nohighlight">\(\gamma(0)\)</span></p>
</div></blockquote>
<p><strong>n</strong></p>
<blockquote>
<div><p>the order to which to expand</p>
</div></blockquote>
<p><strong>coord_sys</strong></p>
<blockquote>
<div><p>the coordinate system in which to expand
coeffs (default False) - if True return a list of elements of the expansion</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>Integral curve is a function <span class="math notranslate nohighlight">\(\gamma\)</span> taking a parameter in <span class="math notranslate nohighlight">\(R\)</span> to a point
in the manifold. It verifies the equation:</p>
<p><span class="math notranslate nohighlight">\(V(f)\big(\gamma(t)\big) = \frac{d}{dt}f\big(\gamma(t)\big)\)</span></p>
<p>where the given <code class="docutils literal notranslate"><span class="pre">vector_field</span></code> is denoted as <span class="math notranslate nohighlight">\(V\)</span>. This holds for any
value <span class="math notranslate nohighlight">\(t\)</span> for the parameter and any scalar field <span class="math notranslate nohighlight">\(f\)</span>.</p>
<p>This equation can also be decomposed of a basis of coordinate functions
<span class="math notranslate nohighlight">\(V(f_i)\big(\gamma(t)\big) = \frac{d}{dt}f_i\big(\gamma(t)\big) \quad \forall i\)</span></p>
<p>This function returns a series expansion of <span class="math notranslate nohighlight">\(\gamma(t)\)</span> in terms of the
coordinate system <code class="docutils literal notranslate"><span class="pre">coord_sys</span></code>. The equations and expansions are necessarily
done in coordinate-system-dependent way as there is no other way to
represent movement between points on the manifold (i.e. there is no such
thing as a difference of points for a general manifold).</p>
<p class="rubric">Examples</p>
<p>Use the predefined R2 manifold:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">t</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_p</span><span class="p">,</span> <span class="n">R2_r</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">intcurve_series</span>
</pre></div>
</div>
<p>Specify a starting point and a vector field:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">start_point</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">point</span><span class="p">([</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">vector_field</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">e_x</span>
</pre></div>
</div>
<p>Calculate the series:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">intcurve_series</span><span class="p">(</span><span class="n">vector_field</span><span class="p">,</span> <span class="n">t</span><span class="p">,</span> <span class="n">start_point</span><span class="p">,</span> <span class="n">n</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
<span class="go">Matrix([</span>
<span class="go">[t + x],</span>
<span class="go">[    y]])</span>
</pre></div>
</div>
<p>Or get the elements of the expansion in a list:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">series</span> <span class="o">=</span> <span class="n">intcurve_series</span><span class="p">(</span><span class="n">vector_field</span><span class="p">,</span> <span class="n">t</span><span class="p">,</span> <span class="n">start_point</span><span class="p">,</span> <span class="n">n</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">coeffs</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">series</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="go">Matrix([</span>
<span class="go">[x],</span>
<span class="go">[y]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">series</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
<span class="go">Matrix([</span>
<span class="go">[t],</span>
<span class="go">[0]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">series</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
<span class="go">Matrix([</span>
<span class="go">[0],</span>
<span class="go">[0]])</span>
</pre></div>
</div>
<p>The series in the polar coordinate system:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">series</span> <span class="o">=</span> <span class="n">intcurve_series</span><span class="p">(</span><span class="n">vector_field</span><span class="p">,</span> <span class="n">t</span><span class="p">,</span> <span class="n">start_point</span><span class="p">,</span>
<span class="gp">... </span>            <span class="n">n</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">coord_sys</span><span class="o">=</span><span class="n">R2_p</span><span class="p">,</span> <span class="n">coeffs</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">series</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="go">Matrix([</span>
<span class="go">[sqrt(x**2 + y**2)],</span>
<span class="go">[      atan2(y, x)]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">series</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
<span class="go">Matrix([</span>
<span class="go">[t*x/sqrt(x**2 + y**2)],</span>
<span class="go">[   -t*y/(x**2 + y**2)]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">series</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
<span class="go">Matrix([</span>
<span class="go">[t**2*(-x**2/(x**2 + y**2)**(3/2) + 1/sqrt(x**2 + y**2))/2],</span>
<span class="go">[                                t**2*x*y/(x**2 + y**2)**2]])</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.diffgeom.intcurve_diffequ" title="sympy.diffgeom.intcurve_diffequ"><code class="xref py py-obj docutils literal notranslate"><span class="pre">intcurve_diffequ</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.diffgeom.intcurve_diffequ">
<span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">intcurve_diffequ</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">vector_field</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">param</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">start_point</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coord_sys</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L1783-L1870"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.intcurve_diffequ" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the differential equation for an integral curve of the field.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>vector_field</strong></p>
<blockquote>
<div><p>the vector field for which an integral curve will be given</p>
</div></blockquote>
<p><strong>param</strong></p>
<blockquote>
<div><p>the argument of the function <span class="math notranslate nohighlight">\(\gamma\)</span> from R to the curve</p>
</div></blockquote>
<p><strong>start_point</strong></p>
<blockquote>
<div><p>the point which corresponds to <span class="math notranslate nohighlight">\(\gamma(0)\)</span></p>
</div></blockquote>
<p><strong>coord_sys</strong></p>
<blockquote>
<div><p>the coordinate system in which to give the equations</p>
</div></blockquote>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>a tuple of (equations, initial conditions)</p>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>Integral curve is a function <span class="math notranslate nohighlight">\(\gamma\)</span> taking a parameter in <span class="math notranslate nohighlight">\(R\)</span> to a point
in the manifold. It verifies the equation:</p>
<p><span class="math notranslate nohighlight">\(V(f)\big(\gamma(t)\big) = \frac{d}{dt}f\big(\gamma(t)\big)\)</span></p>
<p>where the given <code class="docutils literal notranslate"><span class="pre">vector_field</span></code> is denoted as <span class="math notranslate nohighlight">\(V\)</span>. This holds for any
value <span class="math notranslate nohighlight">\(t\)</span> for the parameter and any scalar field <span class="math notranslate nohighlight">\(f\)</span>.</p>
<p>This function returns the differential equation of <span class="math notranslate nohighlight">\(\gamma(t)\)</span> in terms of the
coordinate system <code class="docutils literal notranslate"><span class="pre">coord_sys</span></code>. The equations and expansions are necessarily
done in coordinate-system-dependent way as there is no other way to
represent movement between points on the manifold (i.e. there is no such
thing as a difference of points for a general manifold).</p>
<p class="rubric">Examples</p>
<p>Use the predefined R2 manifold:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">t</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2</span><span class="p">,</span> <span class="n">R2_p</span><span class="p">,</span> <span class="n">R2_r</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">intcurve_diffequ</span>
</pre></div>
</div>
<p>Specify a starting point and a vector field:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">start_point</span> <span class="o">=</span> <span class="n">R2_r</span><span class="o">.</span><span class="n">point</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">vector_field</span> <span class="o">=</span> <span class="o">-</span><span class="n">R2</span><span class="o">.</span><span class="n">y</span><span class="o">*</span><span class="n">R2</span><span class="o">.</span><span class="n">e_x</span> <span class="o">+</span> <span class="n">R2</span><span class="o">.</span><span class="n">x</span><span class="o">*</span><span class="n">R2</span><span class="o">.</span><span class="n">e_y</span>
</pre></div>
</div>
<p>Get the equation:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">equations</span><span class="p">,</span> <span class="n">init_cond</span> <span class="o">=</span> <span class="n">intcurve_diffequ</span><span class="p">(</span><span class="n">vector_field</span><span class="p">,</span> <span class="n">t</span><span class="p">,</span> <span class="n">start_point</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">equations</span>
<span class="go">[f_1(t) + Derivative(f_0(t), t), -f_0(t) + Derivative(f_1(t), t)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">init_cond</span>
<span class="go">[f_0(0), f_1(0) - 1]</span>
</pre></div>
</div>
<p>The series in the polar coordinate system:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">equations</span><span class="p">,</span> <span class="n">init_cond</span> <span class="o">=</span> <span class="n">intcurve_diffequ</span><span class="p">(</span><span class="n">vector_field</span><span class="p">,</span> <span class="n">t</span><span class="p">,</span> <span class="n">start_point</span><span class="p">,</span> <span class="n">R2_p</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">equations</span>
<span class="go">[Derivative(f_0(t), t), Derivative(f_1(t), t) - 1]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">init_cond</span>
<span class="go">[f_0(0) - 1, f_1(0) - pi/2]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.diffgeom.intcurve_series" title="sympy.diffgeom.intcurve_series"><code class="xref py py-obj docutils literal notranslate"><span class="pre">intcurve_series</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.diffgeom.vectors_in_basis">
<span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">vectors_in_basis</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">to_sys</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L1981-L2005"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.vectors_in_basis" title="Permalink to this definition">¶</a></dt>
<dd><p>Transform all base vectors in base vectors of a specified coord basis.
While the new base vectors are in the new coordinate system basis, any
coefficients are kept in the old system.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">vectors_in_basis</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2_r</span><span class="p">,</span> <span class="n">R2_p</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">vectors_in_basis</span><span class="p">(</span><span class="n">R2_r</span><span class="o">.</span><span class="n">e_x</span><span class="p">,</span> <span class="n">R2_p</span><span class="p">)</span>
<span class="go">-y*e_theta/(x**2 + y**2) + x*e_rho/sqrt(x**2 + y**2)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">vectors_in_basis</span><span class="p">(</span><span class="n">R2_p</span><span class="o">.</span><span class="n">e_r</span><span class="p">,</span> <span class="n">R2_r</span><span class="p">)</span>
<span class="go">sin(theta)*e_y + cos(theta)*e_x</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.diffgeom.twoform_to_matrix">
<span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">twoform_to_matrix</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L2011-L2051"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.twoform_to_matrix" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the matrix representing the twoform.</p>
<p>For the twoform <span class="math notranslate nohighlight">\(w\)</span> return the matrix <span class="math notranslate nohighlight">\(M\)</span> such that <span class="math notranslate nohighlight">\(M[i,j]=w(e_i, e_j)\)</span>,
where <span class="math notranslate nohighlight">\(e_i\)</span> is the i-th base vector field for the coordinate system in
which the expression of <span class="math notranslate nohighlight">\(w\)</span> is given.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">twoform_to_matrix</span><span class="p">,</span> <span class="n">TensorProduct</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TP</span> <span class="o">=</span> <span class="n">TensorProduct</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">twoform_to_matrix</span><span class="p">(</span><span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">)</span> <span class="o">+</span> <span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">))</span>
<span class="go">Matrix([</span>
<span class="go">[1, 0],</span>
<span class="go">[0, 1]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">twoform_to_matrix</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">x</span><span class="o">*</span><span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">)</span> <span class="o">+</span> <span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">))</span>
<span class="go">Matrix([</span>
<span class="go">[x, 0],</span>
<span class="go">[0, 1]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">twoform_to_matrix</span><span class="p">(</span><span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">)</span> <span class="o">+</span> <span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">)</span> <span class="o">-</span> <span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span>
<span class="go">Matrix([</span>
<span class="go">[   1, 0],</span>
<span class="go">[-1/2, 1]])</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.diffgeom.metric_to_Christoffel_1st">
<span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">metric_to_Christoffel_1st</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L2054-L2084"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.metric_to_Christoffel_1st" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the nested list of Christoffel symbols for the given metric.
This returns the Christoffel symbol of first kind that represents the
Levi-Civita connection for the given metric.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">metric_to_Christoffel_1st</span><span class="p">,</span> <span class="n">TensorProduct</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TP</span> <span class="o">=</span> <span class="n">TensorProduct</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">metric_to_Christoffel_1st</span><span class="p">(</span><span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">)</span> <span class="o">+</span> <span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">))</span>
<span class="go">[[[0, 0], [0, 0]], [[0, 0], [0, 0]]]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">metric_to_Christoffel_1st</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">x</span><span class="o">*</span><span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">)</span> <span class="o">+</span> <span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">))</span>
<span class="go">[[[1/2, 0], [0, 0]], [[0, 0], [0, 0]]]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.diffgeom.metric_to_Christoffel_2nd">
<span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">metric_to_Christoffel_2nd</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L2087-L2123"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.metric_to_Christoffel_2nd" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the nested list of Christoffel symbols for the given metric.
This returns the Christoffel symbol of second kind that represents the
Levi-Civita connection for the given metric.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">metric_to_Christoffel_2nd</span><span class="p">,</span> <span class="n">TensorProduct</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TP</span> <span class="o">=</span> <span class="n">TensorProduct</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">metric_to_Christoffel_2nd</span><span class="p">(</span><span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">)</span> <span class="o">+</span> <span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">))</span>
<span class="go">[[[0, 0], [0, 0]], [[0, 0], [0, 0]]]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">metric_to_Christoffel_2nd</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">x</span><span class="o">*</span><span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">)</span> <span class="o">+</span> <span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">))</span>
<span class="go">[[[1/(2*x), 0], [0, 0]], [[0, 0], [0, 0]]]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.diffgeom.metric_to_Riemann_components">
<span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">metric_to_Riemann_components</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L2126-L2177"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.metric_to_Riemann_components" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the components of the Riemann tensor expressed in a given basis.</p>
<p>Given a metric it calculates the components of the Riemann tensor in the
canonical basis of the coordinate system in which the metric expression is
given.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">exp</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">metric_to_Riemann_components</span><span class="p">,</span> <span class="n">TensorProduct</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TP</span> <span class="o">=</span> <span class="n">TensorProduct</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">metric_to_Riemann_components</span><span class="p">(</span><span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">)</span> <span class="o">+</span> <span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">))</span>
<span class="go">[[[[0, 0], [0, 0]], [[0, 0], [0, 0]]], [[[0, 0], [0, 0]], [[0, 0], [0, 0]]]]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">non_trivial_metric</span> <span class="o">=</span> <span class="n">exp</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">R2</span><span class="o">.</span><span class="n">r</span><span class="p">)</span><span class="o">*</span><span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dr</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dr</span><span class="p">)</span> <span class="o">+</span>         <span class="n">R2</span><span class="o">.</span><span class="n">r</span><span class="o">**</span><span class="mi">2</span><span class="o">*</span><span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dtheta</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dtheta</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">non_trivial_metric</span>
<span class="go">exp(2*rho)*TensorProduct(drho, drho) + rho**2*TensorProduct(dtheta, dtheta)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">riemann</span> <span class="o">=</span> <span class="n">metric_to_Riemann_components</span><span class="p">(</span><span class="n">non_trivial_metric</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">riemann</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="p">:,</span> <span class="p">:,</span> <span class="p">:]</span>
<span class="go">[[[0, 0], [0, 0]], [[0, exp(-2*rho)*rho], [-exp(-2*rho)*rho, 0]]]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">riemann</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="p">:,</span> <span class="p">:,</span> <span class="p">:]</span>
<span class="go">[[[0, -1/rho], [1/rho, 0]], [[0, 0], [0, 0]]]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.diffgeom.metric_to_Ricci_components">
<span class="sig-prename descclassname"><span class="pre">sympy.diffgeom.</span></span><span class="sig-name descname"><span class="pre">metric_to_Ricci_components</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/diffgeom/diffgeom.py#L2180-L2212"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.diffgeom.metric_to_Ricci_components" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the components of the Ricci tensor expressed in a given basis.</p>
<p>Given a metric it calculates the components of the Ricci tensor in the
canonical basis of the coordinate system in which the metric expression is
given.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">exp</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom.rn</span> <span class="kn">import</span> <span class="n">R2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.diffgeom</span> <span class="kn">import</span> <span class="n">metric_to_Ricci_components</span><span class="p">,</span> <span class="n">TensorProduct</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TP</span> <span class="o">=</span> <span class="n">TensorProduct</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">metric_to_Ricci_components</span><span class="p">(</span><span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dx</span><span class="p">)</span> <span class="o">+</span> <span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dy</span><span class="p">))</span>
<span class="go">[[0, 0], [0, 0]]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">non_trivial_metric</span> <span class="o">=</span> <span class="n">exp</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">R2</span><span class="o">.</span><span class="n">r</span><span class="p">)</span><span class="o">*</span><span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dr</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dr</span><span class="p">)</span> <span class="o">+</span>                              <span class="n">R2</span><span class="o">.</span><span class="n">r</span><span class="o">**</span><span class="mi">2</span><span class="o">*</span><span class="n">TP</span><span class="p">(</span><span class="n">R2</span><span class="o">.</span><span class="n">dtheta</span><span class="p">,</span> <span class="n">R2</span><span class="o">.</span><span class="n">dtheta</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">non_trivial_metric</span>
<span class="go">exp(2*rho)*TensorProduct(drho, drho) + rho**2*TensorProduct(dtheta, dtheta)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">metric_to_Ricci_components</span><span class="p">(</span><span class="n">non_trivial_metric</span><span class="p">)</span>
<span class="go">[[1/rho, 0], [0, exp(-2*rho)*rho]]</span>
</pre></div>
</div>
</dd></dl>

</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../index.html">
              <img class="logo" src="../_static/sympylogo.png" alt="Logo"/>
            </a></p>
  <h3><a href="../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Differential Geometry</a><ul>
<li><a class="reference internal" href="#introduction">Introduction</a></li>
<li><a class="reference internal" href="#base-class-reference">Base Class Reference</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="crypto.html"
                        title="previous chapter">Cryptography</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="solvers/diophantine.html"
                        title="next chapter">Diophantine</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/modules/diffgeom.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="https://docs.sympy.org/latest/search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="solvers/diophantine.html" title="Diophantine"
             >next</a> |</li>
        <li class="right" >
          <a href="crypto.html" title="Cryptography"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" >SymPy Modules Reference</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Differential Geometry</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021 SymPy Development Team.
      Last updated on Sep 30, 2021.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
    </div>
  </body>

<!-- Mirrored from docs.sympy.org/latest/modules/diffgeom.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:24:21 GMT -->
</html>